package com.yuanfeng.job.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.commoms.util.ParseMapUtils;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.job.entity.JobOrderNotCompletedEntity;
import com.yuanfeng.job.mapper.JobOrderNotCompletedMapper;
import com.yuanfeng.job.service.JobOrderNotCompletedService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *
 */
@Service
public class JobOrderNotCompletedServiceImpl extends ServiceImpl<JobOrderNotCompletedMapper, JobOrderNotCompletedEntity>
    implements JobOrderNotCompletedService {

    @Override
    public ResponseResult insertNotCompletedJobimplements(String finishTime) {
        List<Map<String,Object>> result = this.baseMapper.queryNotCompletedparam(finishTime);

        List<JobOrderNotCompletedEntity> entities=new ArrayList<>();
        if (!CollectionUtils.isEmpty(result)){
            for (Map<String,Object> map:result) {
                JobOrderNotCompletedEntity entity= ParseMapUtils.parseMap2Object(map,JobOrderNotCompletedEntity.class);
                entities.add(entity);
            }
            this.saveBatch(entities);
        }


        return ResponseResult.success();
    }
}




